package main

import "fmt"

//管道可以声明为只读 或只写
func main() {
	//一个双向的，可读可写的管道
	var fullChan chan int
	fmt.Println(fullChan)

	//只写管道
	var writeOnlyChan chan<- int
	fmt.Println(writeOnlyChan)
	//<-writeOnlyChan //invalid operation: <-writeOnlyChan (receive from send-only type chan<- int)

	//只读管道
	var readOnlyChan <-chan int
	fmt.Println(readOnlyChan)
	//readOnlyChan <- 1 //invalid operation: readOnlyChan <- 1 (send to receive-only type <-chan int)
}
